package com.agileai.bpm.domain.define;

import com.agileai.util.StringUtil;

public class Transition extends DefineObject{
	private String processId = null;
	private Activity fromActivity = null;
	private Activity toActivity = null;
	private String transType = TransType.auto;
	private String expression = null;
	private String conditionType = null;
	
	public Transition(){
	}
	
	public Activity getToActivity() {
		return toActivity;
	}
	public void setToActivity(Activity toActivity) {
		toActivity.getInTransitionList().add(this);
		this.toActivity = toActivity;
	}
	public Activity getFromActivity() {
		return fromActivity;
	}
	public void setFromActivity(Activity fromActivity) {
		fromActivity.getOutTransitionList().add(this);
		this.fromActivity = fromActivity;
	}
	
	public static class TransType{
		public static final String auto = "auto";
		public static final String cond = "cond";
	}
	public static class Condion{
		public static final String ifcluse = "if";
		public static final String elsecluse = "else";
	}
	
	public String getTransType() {
		return transType;
	}
	public void setTransType(String transType) {
		if (!StringUtil.isNullOrEmpty(transType)){
			this.transType = transType;	
		}
	}
	public String getExpression() {
		return expression;
	}
	public void setExpression(String expression) {
		this.expression = expression;
	}

	public String getConditionType() {
		return conditionType;
	}

	public void setConditionType(String conditionType) {
		this.conditionType = conditionType;
	}

	public String getProcessId() {
		return processId;
	}

	public void setProcessId(String processId) {
		this.processId = processId;
	}
}
